﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.Entity;
using System.Web;
using System.Web.Mvc;
using TCC.CMFlow.Contexts;
using Microsoft.AspNet.Identity;

namespace TCC.CMFlow.Controllers
{
    public class MenuController : Controller
    {
        private DataContext db = new DataContext();

        // GET: /ModuloSistema/Menu
        public ActionResult MainMenu()
        {
            //var usuario = db.Users.Find(User.Identity.GetUserId());
            //var moduloSistemaItens = usuario.PerfilAcesso.ModulosSistema
            //                                            .Where(m => m.ModuloPai == null
            //                                                  && m.IncluirMenu == true)
            //                                         .AsQueryable()
            //                                         .Include(m => m.ModuloSistemaItems)
            //                                         .OrderBy(m => m.OrdemMenu);

            var menuSistema = db.MenuSistema.Where(m => m.IncluirMenu == true)
                                            .Include(m => m.ModulosSistema)
                                            .OrderBy(m => m.OrdemMenu);

            return PartialView(menuSistema);
        }

	}
}